lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: finding the position of a term in a field.....
Date Wed, 05 Oct 2005 10:45:16 GMT

On Oct 5, 2005, at 4:17 AM, shadab khan wrote:

> hi all,
> while indexing for a document, one field i am using is "contents".
>
> doc.add(Field.Text("contents", reader));
>
> the "contents" field is not being stored in index(only being  
> tokenize and indexing. Now my problem is to find the position for a  
> word from this field(i.e. contents). if you have a solution for  
> this plzz send it to me asap.

One solution is to store it.  :)   Field.Text(String,Reader) does not  
store though, only Field.Text(String,String).  So you will need to  
load it as a String first to do that.  An alternative is to grab the  
contents from its original location when you need the positions and  
re-run the Analyzer on the text to get the Tokens with position  
information.  There is also some enhancements in the trunk  
(unreleased) version of Lucene you may try to store offset and  
position information in the index.

     Erik


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


Mime
View raw message