You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by lukes <ma...@gmail.com> on 2016/08/08 19:02:15 UTC

Newbie Questions

I am new to Lucene and couple of questions. I have worked with SOLR
previously, now trying to work directly with Lucene to get similar
functionality(but without SOLR). Below are my questions, thanks in advance.

1) In SOLR, there is functionality of copyfields, which dynamically copies
one field value to destination field but without actually storing it in
second time. Does Lucene provides anything directly out of the box ? If i
have to implement such feature, then i need to manually copy the value from
1 field and create new field out of it ?

2) How do i create BooleanField (while creating the document) ? And during
query, how do i create clause/query for that field ?

3) How can i perform filter and query in one call ? I want some fields to
participate in the filter, but not in the score. How can i do that ?  

Really appreciate the help in advance.
Regards, 



--
View this message in context: http://lucene.472066.n3.nabble.com/Newbie-Questions-tp4290817.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

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


Re: Newbie Questions

Posted by Christoph Kaser <lu...@iconparc.de>.
There is no way to "update" a document in lucene, you always have to 
remove the existing document and add the updated version with ALL its 
fields. The updateDocument-method of IndexWriter exists only for 
convenience (and to assure the operation is atomic), but internally it 
does just that: remove the old document and add a new one.
In generally, this works best if you get all fields of the document from 
your external datasource instead of the index, because depending on your 
field configuration, there might be some information missing (especially 
for fields that are not STORED or DocValues).

See also the Lucene FAQ:
https://wiki.apache.org/lucene-java/LuceneFAQ#How_do_I_update_a_document_or_a_set_of_documents_that_are_already_indexed.3F

Regards

Am 09.08.2016 um 20:51 schrieb lukes:
> Thanks for the reply.
>
>    Is there a way to partially update the document ? I know there's a API
> updateDocument on IndexWriter, but that seems to create a new document with
> just a field i am specifying. What i want is delete some fields from
> existing(indexed) document, and then add some new fields(could or not be
> same). Alternatively i tried to search for the document, and then calling
> removeFields and finally updateDocument, but now any search after the above
> process is not able for find that document(I created the new IndexReader).
> Am i missing anything ?
>
> Regards.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Newbie-Questions-tp4290817p4291024.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>



Re: Newbie Questions

Posted by lukes <ma...@gmail.com>.
Thanks for the reply.

  Is there a way to partially update the document ? I know there's a API
updateDocument on IndexWriter, but that seems to create a new document with
just a field i am specifying. What i want is delete some fields from
existing(indexed) document, and then add some new fields(could or not be
same). Alternatively i tried to search for the document, and then calling
removeFields and finally updateDocument, but now any search after the above
process is not able for find that document(I created the new IndexReader).
Am i missing anything ? 

Regards.



--
View this message in context: http://lucene.472066.n3.nabble.com/Newbie-Questions-tp4290817p4291024.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

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


Re: Newbie Questions

Posted by "Bauer, Herbert S. (Scott)" <Ba...@mayo.edu>.
You might start here:

http://lucene.apache.org/core/6_1_0/core/org/apache/lucene/index/IndexWrite
r.html



On 8/8/16, 8:17 PM, "lukes" <ma...@gmail.com> wrote:

>Can anyone please reply ? .
>
>Regards.
>
>
>
>--
>View this message in context:
>http://lucene.472066.n3.nabble.com/Newbie-Questions-tp4290817p4290854.html
>Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>---------------------------------------------------------------------
>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


Re: Newbie Questions

Posted by lukes <ma...@gmail.com>.
Can anyone please reply ? .

Regards.



--
View this message in context: http://lucene.472066.n3.nabble.com/Newbie-Questions-tp4290817p4290854.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

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