Hi,

 

The following query, I am getting only the file path results. I have a field
name 'text' in the index. May I know do I display the text file data?

Is this the problem with the indexing or the query string?

 

Creating Index:

Document doc5 = new Document();

doc5.add(Field.UnIndexed("path", path));

doc5.add(Field.Text("MMmanualType", new StringReader(manualType)));

doc5.add(Field.Text("text", new StringReader(info)));

 

 

Search:

TermQuery queryOM = new TermQuery(new Term("text",OMcriteriaIn));

subquery.add(new BooleanClause(query3, true, false)); 

subquery.add(new BooleanClause(queryOM, true, false)); 

System.out.println("Searching for: " + subquery.toString("text"));

Hits hits = searcher.search(subquery);

System.out.println("Number of matching documents = " + hits.length());

 

for (int c = 0; c < hits.length(); c++) {

Document doc = hits.doc(c);

System.out.println("Query found in file: " + doc.get("path"));

System.out.println("Content: " + doc.get("text"));

 


}

 

 

Regards,

Lee Li Bin

 

Reply via email to