Alternatively, you could examine each path, and index each of its "parent" paths (perhaps in a field named "parentPath").
i.e.
 Top/World/Poland/Abc
would result in the following three values being indexed:
 Top
 Top/World
 Top/World/Poland
You can then use a TermQuery instead of a PrefixQuery.
For instance, to perform the query that you suggested, you would code it as follows:

say, cat="Top/World/Poland"

Query query1 = null;
if(cat!=""){
  Term term = new Term("category",cat);
  query1 = new TermQuery(term);
  Hits hits = is.search(query1);
}

NB as an aside, unless "cat" is interned, (cat!="") will ALWAYS return true. But you probably knew that ;-)

Kieran

Java Programmer wrote:
Reply to myself hate this :(

What about such solution:
Split path like string into smaller tokens and index them as seperate words eg:
#Top/World/Poland/# #Top/World/# #Top/#
so if I ask about word #Top/# I will get all the results for this
category, without making so many boolean queries.

Is there a better solution for my problem?

Best Regards,
Adr

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to