quinta-feira, 17 de novembro de 2011

What is the different between Stored, Tokenized, Indexed, and Vector?

  • Stored = as-is value stored in the Lucene index
  • Tokenized = field is analyzed using the specified Analyzer - the tokens emitted are indexed
  • Indexed = the text (either as-is with keyword fields, or the tokens from tokenized fields) is made searchable (aka inverted)
  • Vectored = term frequency per document is stored in the index in an easily retrievable fashion.

terça-feira, 6 de setembro de 2011

Encontrar um arquivo com determinado conteudo

Precisei procurar aonde estava o arquivo com o conteúdo "consulta_generica_sql". Assim executei
uma procura de arquivos com extensão ".php" e procurei em cada arquivo o conteúdo "consulta_generica_sql".

find . -name '*.php' | while read Linha; do echo $Linha; cat $Linha | grep consulta_generica_sql; done

segunda-feira, 28 de março de 2011

Campos POSTGRES

Consulta para apresentar os campos de uma tabela POSTGRES

select c.relname, a.attname as "Column", pg_catalog.format_type(a.atttypid, a.atttypmod) as "Datatype"
from pg_catalog.pg_attribute a inner join pg_stat_user_tables c
on a.attrelid = c.relid
WHERE a.attnum > 0
and NOT a.attisdropped
and c.relname = 'nome tabela'


Para mudar o tipo de letra de campos da tabela. Neste exemplo estou transformando para caixa baixa todos os campos de 'nome tabela'

update pg_catalog.pg_attribute a  set attname=lower(attname)
where a.attrelid in
(select relid from pg_stat_user_tables c
WHERE  c.relname = 'nome tabela' )
and a.attnum > 0
and NOT a.attisdropped

segunda-feira, 24 de janeiro de 2011

Exemplo de Expressão Regular

public static void main(String[] args){
String entrada;
String endereco;
String padrao="href=\"[a-zA-Z.0-9/:_+\-]*.jpg";
padrao="h[a-zA-Z.0-9/:_+\-]*-h/[a-zA-Z.0-9/:_+\-]*.png";
FileInputDemo aux = new FileInputDemo();
File testFile = new File("c:/Aulas/RegEx/pagina_julho_2010a.txt");
entrada = aux.getContents(testFile);
URLConnectionReader auxUrl = new URLConnectionReader();
Pattern pattern = Pattern.compile(padrao);

Matcher matcher = pattern.matcher(entrada);

boolean found = false;
while (matcher.find()) {
endereco = matcher.group().substring(6);
try {
System.out.println(endereco);
// auxUrl.urlRead(endereco);
} catch (Exception ex) {
Logger.getLogger(RegEx.class.getName()).log(Level.SEVERE, null, ex);
}
found = true;
}
if(!found){
System.out.printf("No match found.%n");
}
}
}