lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Wettin <karl.wet...@gmail.com>
Subject Re: Searching for instances within a document
Date Fri, 11 Jul 2008 18:39:37 GMT

11 jul 2008 kl. 15.28 skrev jnance:
>
> The TermFrequencyVector works perfectly for normal query strings.  
> But if I
> add a wild card (*) onto words to search for different forms of the  
> word I
> get an ArrayIndexOutOfBoundsException because the index is -1. Why  
> does this
> happen? And is there anyway to avoid it?

It is because

> public interface TermFreqVector {
>
>   /** Return an index in the term numbers array returned from
>    *  <code>getTerms</code> at which the term with the specified
>    *  <code>term</code> appears. If this term does not appear in the  
> array,
>    *  return -1.
>    */
>   public int indexOf(String term);

accepts a term text value and you try feed it with an unparsed query  
string. The respose is negative as there is no term in the document  
with the term text value 'foo*'.

One way to solve your problem is to enumerate the terms of the vector  
and see if it.startsWith("foo");


You should probably explain what it is you try to achive by doing this.


     karl

---------------------------------------------------------------------
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