Hi all!! I'm using PrefixQuery in my search application and I get TooManyClauses. I have found many information about this problem and the solutions seems to be the use of a FilteredQuery.
Now, I'm trying to write my Filter ...
Well, the problem is that when i try to write the "bits" function of my
filter, I need to query all the index checking if the value of field
name "path" is a prefix or not.
There's a way to do that query without having to retrieve all the
Document instances from the index?
public class PrefijoURLFilter extends Filter
{
private String field;
private String[] prefix;
public PrefijoURLFilter(String field, String[] prefix)
{
this.field = field;
this.prefix = prefix;
}
public BitSet bits(IndexReader reader) throws IOException
{
BitSet bits = new BitSet(reader.maxDoc());
//FOR EACH PREFIX AND FOR EACH DOCUMENT IN INDEX CHECK IF
//STARTS WITH A VALID PREFIX AND SET IT IN THE BITSET
return bits;
}
}
A valid usage of this filter could be:
filter = new PrefijoURLFilter("path", new String[] {
"http://xxx/CA/noticies/agenda/",
"http://xxx/noticies/agenda/",
"http://xxx/CA/content/agenda/",
"http://xxx/content/agenda/"
});
Thanks a lot!!!
--
Salut,
====================================
Ricardo Borillo Domenech
Analista/Programador - Servei d'Informàtica
Universitat Jaume I
http://xml-utils.com
smime.p7s
Description: S/MIME cryptographic signature
