You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Lyuba Romanchuk <ly...@gmail.com> on 2012/04/12 17:28:36 UTC

[Solr 4.0] Is it possible to do soft commit from code and not configuration only

Hi,



I need to configure the solr so that the opened searcher will see a new
document immidiately after it was adding to the index.

And I don't want to perform commit each time a new document is added.

I tried to configure maxDocs=1 under autoSoftCommit in solrconfig.xml but
it didn't help.

Is there way to perform soft commit from code in Solr 4.0 ?


Thank you in advance.

Best regards,

Lyuba

Re: [Solr 4.0] Is it possible to do soft commit from code and not configuration only

Posted by Lyuba Romanchuk <ly...@gmail.com>.
Hi Mark,

Thank you for reply.

I tried to normalize data like in relational databases:

   - there are some types of documents where \
      - documents with the same type have the same fields
      - documents with not equal types may have different fields
      - but all documents have "type" field and unique key field "id" .
   - there is "main" type (all records with this type contains "pointers"
   to the corresponding records of other types)

There is the configuration that defines what information should be stored
in each type.
When I get a new data for indexing first of all I check if such document is
already in the index\
using facets by the corresponding fields and query on relevant type.
I add documents to solr index without commit from the code but with
autocommit and autoSoftCommit with maxDocs=1 in the solrconfig.xml.
But here there is a problem that if I add a new record for some type the
searcher doesn't see it immediately.
It causes that I get some equal records with the same type but different
ids (unique key).

If I do commit from code after each document is added it works OK but it's
not a solution.
So I wanted to try to do soft commit after adding documents with "not-main"
type  from code. I searched in wiki documents
but found only commit without parameters and commit with parameters that
don't seem to be what I need.

Best regards,
Lyuba
*
*
*
*

On Thu, Apr 12, 2012 at 6:55 PM, Mark Miller <ma...@gmail.com> wrote:

>
> On Apr 12, 2012, at 11:28 AM, Lyuba Romanchuk wrote:
>
> > Hi,
> >
> >
> >
> > I need to configure the solr so that the opened searcher will see a new
> > document immidiately after it was adding to the index.
> >
> > And I don't want to perform commit each time a new document is added.
> >
> > I tried to configure maxDocs=1 under autoSoftCommit in solrconfig.xml but
> > it didn't help.
>
> Can you elaborate on didn't help? You couldn't find any docs unless you
> did an explicit commit? If that is true and there is no user error, this
> would be a bug.
>
> >
> > Is there way to perform soft commit from code in Solr 4.0 ?
>
> Yes - check out the wiki docs - I can't remember how it is offhand (I
> think it was slightly changed recently).
>
> >
> >
> > Thank you in advance.
> >
> > Best regards,
> >
> > Lyuba
>
> - Mark Miller
> lucidimagination.com
>
>
>
>
>
>
>
>
>
>
>
>

Re: [Solr 4.0] Is it possible to do soft commit from code and not configuration only

Posted by Mark Miller <ma...@gmail.com>.
On Apr 12, 2012, at 11:28 AM, Lyuba Romanchuk wrote:

> Hi,
> 
> 
> 
> I need to configure the solr so that the opened searcher will see a new
> document immidiately after it was adding to the index.
> 
> And I don't want to perform commit each time a new document is added.
> 
> I tried to configure maxDocs=1 under autoSoftCommit in solrconfig.xml but
> it didn't help.

Can you elaborate on didn't help? You couldn't find any docs unless you did an explicit commit? If that is true and there is no user error, this would be a bug.

> 
> Is there way to perform soft commit from code in Solr 4.0 ?

Yes - check out the wiki docs - I can't remember how it is offhand (I think it was slightly changed recently).

> 
> 
> Thank you in advance.
> 
> Best regards,
> 
> Lyuba

- Mark Miller
lucidimagination.com