I just added a way to do this (not as a persistent config, since they
control write behaviour), but instead as an addition to QueryContext. So you
can do like this:

    myNodeIndex.query( new QueryContext( "name:Mattias occupation:developer"
).defaultOperator( Operator.AND ) );

I know it's a bit verbose, but it's a start at least. Grab the latest
version and try it out to see if it works for you.

2010/9/10 Mattias Persson <matt...@neotechnology.com>

> 2010/9/10, Honnur Vorvoi <vhon...@yahoo.com>:
> > I would like to set AND as the default operator when I create index using
> > the new index library:
> > Index = indexProvider.nodeIndex( "fulltext",
> > LuceneIndexProvider.FULLTEXT_CONFIG );
> >
> > I didn't find "setDefaultOperator" (similar to the one
> > in LuceneFulltextQueryIndexService )in any of the provider classes.
> > Is it supported in the new index provider? if not, is there a way we can
> set
> > the same?
> >
> > Thanks in advance.
>
> That functionality is easy to add, I just haven't gotten around to do
> it. I'll try to add that as soon as possible. Excellent feedback on
> the new IndexProvider framework, keep it coming!
>
> >
> >
> > --- On Thu, 9/9/10, Honnur Vorvoi <vhon...@yahoo.com> wrote:
> >
> >
> > From: Honnur Vorvoi <vhon...@yahoo.com>
> > Subject: Re: [Neo4j] IndexProvider question
> > To: user@lists.neo4j.org
> > Date: Thursday, September 9, 2010, 10:33 PM
> >
> >
> >
> >
> >
> >
> >
> > Thanks Mattias.
> > Since IndexProvider does all LuceneFulltextQueryIndexService can do and
> much
> > more, I am going to use just IndexProvider.
> >
> >
> > Date: Wed, 8 Sep 2010 16:28:56 +0200
> > From: Mattias Persson <matt...@neotechnology.com>
> > Subject: Re: [Neo4j] IndexProvider question
> > To: Neo4j user discussions <user@lists.neo4j.org>
> > Message-ID:
> >     <aanlktin4cjw=smw00=1nlkt8ftmys6xtnvtrve_j9...@mail.gmail.com>
> > Content-Type: text/plain; charset=UTF-8
> >
> > Hi Honnur!
> >
> > 2010/9/6, Honnur Vorvoi <vhon...@yahoo.com>:
> >> Hello,
> >>
> >> I have the following questions with regard to the IndexProvider(example
> >> below):
> >>
> >> 1. I already have LuceneFulltextQueryIndexService. Can I use
> IndexProvider
> >> with the same graphDb as well? or are they mutually exclusive?
> >
> > They are separate from one another so both can be used alongside of
> > each other. Something stored in one of either
> > LuceneIndexService/LuceneIndexProvider won't affect the other.
> >
> >> 2. What doesn the param "users" in provider.nodeIndex("users")
> represent?
> >
> > The LuceneIndexService can only keep values from one key in each
> > index, but the new LuceneIndexProvider can spawn indexes which can
> > contain any number of keys and values (making compound queries
> > possible). Since an index isn't tied to a property key you must name
> > each index yourself. Each index can also be configured to be either
> > fulltext or not, to use lower case conversion or not, a.s.o.
> >
> >> 3. Do I need to add all the properties in Index<Node>(line# 4&5) in
> order
> >> to
> >> query? (I have already index the same properties with
> >> LuceneFulltextQueryIndexService)
> >>
> > see my answer for (1), in short: LuceneIndexProvider and the indexes
> > it spawns has nothing to do with LuceneIndexService (or any derivative
> > thereof) and hence can't share state.
> >
> >> 4. Is it easy to include the query(String) method in
> >> LuceneFulltextQueryIndexService, so I can use just one indexservice
> >> otherwise I would be using LuceneIndexProvider just for query(String)
> >> method.
> >
> > To add compound querying the storage format (i.e. Lucene usage) needed
> > to change in incompatible ways, so it isn't an easy fix to add that.
> > It could however be done by querying multiple indexes in parallell and
> > merge the results afterwards, but I don't think performance would be
> > anywhere near using Lucene the "right way" for compound queries, as
> > LuceneIndexProvider does.
> >
> >>
> >> As alwasy, appreciate your suggestions/recommendations
> >>
> >>
> >> 1     IndexProvider provider = new LuceneIndexProvider( graphDb );
> >> 2     Index<Node> myIndex = provider.nodeIndex( "users" );
> >> 3
> >> 4     myIndex.add( myNode, "type", "value1" );
> >> 5     myIndex.add( myNode, "key1", "value2" );
> >> 6
> >> 7     // Ask lucene queries directly here
> >> 8     for ( Node searchHit : myIndex.query( "type:value1 AND
> key1:value2"
> >> )
> >> )
> >> 9     {
> >> 10         System.out.println( "Found " + searchHit );
> >> 11     }
> >> _______________________________________________
> >> Neo4j mailing list
> >> User@lists.neo4j.org
> >> https://lists.neo4j.org/mailman/listinfo/user
> >>
> >
> >
> > --
> > Mattias Persson, [matt...@neotechnology.com]
> > Hacker, Neo Technology
> > www.neotechnology.com
> > _______________________________________________
> > Neo4j mailing list
> > User@lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
> >
>
>
> --
> Mattias Persson, [matt...@neotechnology.com]
> Hacker, Neo Technology
> www.neotechnology.com
>



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to