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

> Btw I don't think lucene can do that kind of multiple-field sorting for
> you, or can it?
>

Scratch that... you can do:

   myNodeIndex.query( new QueryContext( "name:*...@gmail.com" ).sort( new Sort(
new SortField( "name", SortField.STRING ) ) );

that way you let Lucence sort the result for you on the key "name".


>
> 2010/9/23 Mattias Persson <matt...@neotechnology.com>
>
> It doesn't try to use NumericField... maybe that can be done somehow so
>> that range queries can more easily be asked, I'll add that as a ticket
>>
>> 2010/9/23 Paddy <paddyf...@gmail.com>
>>
>> Hi Andreas,
>>> Yes it looks like you don't need to wrap it in a padded string.
>>> I tried using myIndex.add(ndOne, "time",1f); it will stills work.
>>> thanks
>>> Paddy
>>>
>>> On Thu, Sep 23, 2010 at 12:37 AM, Andreas Ronge <andreas.ro...@jayway.se
>>> >wrote:
>>>
>>> > Hi Paddy
>>> >
>>> > Thanks for the response.
>>> > But it would be nice to avoid wrapping integer or float values in
>>> > padded strings, as you described in your example:
>>> > > Node ndOne = gds.createNode();
>>> > > ndOne.setProperty("time", "1.3");
>>> > >    myIndex.add(ndOne, "time", ndOne.getProperty("time") );
>>> > Instead I believe it's possible in Lucene 3.0 to index the time
>>> > property as a float. The question is if this feature is exposed in the
>>> > Neo4j Lucene API ?
>>> >
>>> > Cheers
>>> > Andreas
>>> >
>>> >
>>> > On Thu, Sep 23, 2010 at 8:43 AM, Paddy <paddyf...@gmail.com> wrote:
>>> > > Hi Andres,
>>> > > Not sure about the use of sorting but I have previously tried some
>>> > numeric
>>> > > range queries with the new indexProvider.
>>> > > I've added my some test code i used below.
>>> > >
>>> > >
>>> > > Cheers
>>> > > Paddy
>>> > >
>>> > > public class indexTest {
>>> > > static GraphDatabaseService gds;
>>> > > static IndexProvider provider;
>>> > >
>>> > > @BeforeClass
>>> > > public static void setup() {
>>> > > gds = new EmbeddedGraphDatabase("data/neodb/neodb-tmp");
>>> > >    provider = new LuceneIndexProvider( gds );
>>> > > }
>>> > >
>>> > > @Test
>>> > > public void fullTextIndex() {
>>> > > Transaction tx = gds.beginTx();
>>> > > try {
>>> > > Node ndOne = gds.createNode();
>>> > > ndOne.setProperty("time", "1.3");
>>> > > Node ndTwo = gds.createNode();
>>> > > ndTwo.setProperty("time", "1.5");
>>> > > Node ndThree = gds.createNode();
>>> > > ndThree.setProperty("time", "2.0");
>>> > > Node ndFour = gds.createNode();
>>> > > ndFour.setProperty("time", "3.0");
>>> > > Node ndFive = gds.createNode();
>>> > > ndFive.setProperty("time", "5.0");
>>> > >
>>> > >    Index<Node> myIndex = provider.nodeIndex( "fulltext",
>>> > > LuceneIndexProvider.FULLTEXT_CONFIG );
>>> > >    myIndex.add(ndOne, "time", ndOne.getProperty("time") );
>>> > >    myIndex.add(ndTwo, "time", ndTwo.getProperty("time") );
>>> > >    myIndex.add(ndThree,"time", ndThree.getProperty("time") );
>>> > >    myIndex.add(ndFour, "time", ndFour.getProperty("time") );
>>> > >    myIndex.add(ndFive, "time", ndFive.getProperty("time") );
>>> > >
>>> > >    for ( Node searchHit : myIndex.query( "time:[1.5 TO 4.3]" ) )
>>> > >    {
>>> > >         System.out.println( "Found " + searchHit.toString() );
>>> > >         System.out.println("time" + searchHit.getProperty("time"));
>>> > >     }
>>> > >
>>> > > tx.success();
>>> > > } finally {
>>> > > tx.finish();
>>> > > }
>>> > > }
>>> > > }
>>> > >
>>> > > On Wed, Sep 22, 2010 at 11:15 PM, Andreas Ronge <
>>> andreas.ro...@jayway.se
>>> > >wrote:
>>> > >
>>> > >> Hi
>>> > >>
>>> > >> In the example
>>> > >>
>>> >
>>> https://svn.neo4j.org/laboratory/components/lucene-index/trunk/src/test/java/org/neo4j/index/impl/lucene/TestLuceneIndex.java
>>> > >> I only see how to sort by Sort.RELEVANCE and Sort.INDEXORDER.
>>> > >> How do I sort ascending/ on different fields ?
>>> > >>
>>> > >> Another related question, how does neo4j work with the new improved
>>> > >> numerical capabilities of lucene 3.0.
>>> > >> Example if I add an integer with
>>> > >> org.neo4j.graphdb.index.Index.add(entity, key, integer_value) will
>>> it
>>> > >> be index as a NumericField so that I (how?) can use
>>> > >> NumericRangeQueries ?
>>> > >>
>>> > >> (In old lucene one had to convert integers to strings and pad it
>>> with
>>> > >> zeros)
>>> > >>
>>> > >> Cheers
>>> > >> Andres
>>> > >> _______________________________________________
>>> > >> Neo4j mailing list
>>> > >> User@lists.neo4j.org
>>> > >> https://lists.neo4j.org/mailman/listinfo/user
>>> > >>
>>> > > _______________________________________________
>>> > > Neo4j mailing list
>>> > > User@lists.neo4j.org
>>> > > https://lists.neo4j.org/mailman/listinfo/user
>>> > >
>>> > _______________________________________________
>>> > Neo4j mailing list
>>> > User@lists.neo4j.org
>>> > https://lists.neo4j.org/mailman/listinfo/user
>>> >
>>> _______________________________________________
>>> 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
>



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