lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: List of values from refix query
Date Mon, 05 Sep 2005 21:14:21 GMT
That looks correct.  That's what PrefixQuery is for.  If you use
QueryParser and give if "var*", QP will convert that to PrefixQuery for
you.

Otis

--- Axel <axelclk@gmail.com> wrote:

> Hi
> 
> Assuming that in the indexing process I setup 3 different documents
> doc1, doc2, doc3.
> 
> with something like:
> doc1.add(Field.Keyword("variable", "var_no1"));
> doc1.add(Field.Keyword("variable", "var_test1"));
> 
> doc2.add(Field.Keyword("variable", "var_no2"));
> doc2.add(Field.Keyword("variable", "var_test2"));
> 
> doc3.add(Field.Keyword("variable", "var_no3"));
> 
> How can I get all values across the documents with a given prefix?
> For prefix = "var" for example I would like to have a list of all 5
> values.
> 
> For prefix = "var_no" for example I would like to have a list of the
> values
> {"var_no1", "var_no2", "var_no3"}.
> 
> Is there already a method for this case or must the list be merged
> together from the document Hits for a PrefixQuery?
> 
> ...
> Query query = new PrefixQuery(new Term("variable", prefix));
> Hits hits = fSearcher.search(query);
> ....
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message