I am sorry, but I have to re-open this thread.
The problem is always the same:
- default orient FULLTEXT engine (no lucene)
- for some queries I need the default behaviour: txt containsText "hello
world" returns true only if txt contains both tokens: "hello" AND "world"
- for some other queries I need another beaviour: txt containsText
"hello world" returns true if txt contains one of the tokens: "hello" OR
"world"
One of the approaches suggested previously in this thread will be
appreciated, except the one which assumes an operator with parameters which
seems to me very ugly.
Anyway I have another proposal.
Make available a "parse" function, which exposes the private method
in OIndexFullText.splitIntoWords whose return value is a Collection
(probably a List also if in my case also a set would be ok).
In this way I could write some queries re-using the nice collections
operators, for example:
SELECT FROM V WHERE parse("hello world") IN parse(txt);
In a more general sense I think the OIndexFullText.splitIntoWords should be
accessible in some way, at least with a public class.
What do you think?
Riccardo
Il giorno martedì 22 aprile 2014 19:19:19 UTC+2, Lvc@ ha scritto:
>
> +1
>
>
> On 22 April 2014 19:06, Enrico Risa <[email protected] <javascript:>>
> wrote:
>
>> Sounds good to me.
>> I just don't know if it's better change the containsText behavior or
>> create a new operator that does the job.
>> So leave the containsText as it is and create 2 new operators
>> -matchText (at least one)
>> -matchTextAny (all parsed word)
>>
>> WDYT?
>>
>>
>> 2014-04-22 10:00 GMT+02:00 Riccardo Tasso <[email protected]
>> <javascript:>>:
>>
>> +1 for Davide
>>>
>>>
>>> 2014-04-20 15:56 GMT+02:00 Davide Marquês <[email protected]
>>> <javascript:>>:
>>>
>>> Hi all,
>>>>
>>>> The suggestions with parenthesis and boolean values make the SQL harder
>>>> to read than needed (I can imagine having to check the documentation to
>>>> determine what *CONTAINSTEXT(true, true)* is doing).
>>>>
>>>> When using a fulltext index it's a bit odd that a given string (e.g
>>>> "graph databases") that was present on the original property text isn't
>>>> found when looking it up with containsText. The user will have to remember
>>>> that it's not found becase it was "exploded" before being added to the
>>>> index with the configured separatorChars.
>>>> I think we should change the containsText operator to work like the
>>>> matchText operator suggested by Enrico: parsing & match all words.
>>>>
>>>> The other use case: parsing and matching any of the words could be
>>>> served by a distinct operator containsTextAny.
>>>> This would make the operators pretty straightforward to use.
>>>>
>>>> What do you guys think?
>>>>
>>>> Cheers,
>>>> Davide
>>>>
>>>> On Thursday, April 17, 2014 11:43:36 AM UTC+1, Riccardo Tasso wrote:
>>>>
>>>>> It sounds a bit strange having an operator with parameters, what do
>>>>> you think of something more like a predicate:
>>>>>
>>>>> where CONTAINSTEXT(props, true, true, "graph database")
>>>>>
>>>>> Thanks,
>>>>> Riccardo
>>>>>
>>>>>
>>>>> 2014-04-17 12:33 GMT+02:00 Luca Garulli <[email protected]>:
>>>>>
>>>>>>
>>>>>> On 17 April 2014 11:33, Enrico Risa <[email protected]> wrote:
>>>>>>
>>>>>>> Let's recap the behavior first :D
>>>>>>>
>>>>>>>
>>>>>>> *select from Class where props CONTAINSTEXT(false, false ) "graph
>>>>>>> database" *
>>>>>>>
>>>>>>> its like default ( select from Class where props CONTAINSTEXT "graph
>>>>>>> database")
>>>>>>>
>>>>>>
>>>>>> Yes
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> *select from Class where props CONTAINSTEXT(true, false ) "graph
>>>>>>> database" *
>>>>>>>
>>>>>>> ?
>>>>>>>
>>>>>>
>>>>>> In this case is like the query above, but not you could do:
>>>>>>
>>>>>> *select from Class where props CONTAINSTEXT(true, false ) ["graph",
>>>>>> "database"]*
>>>>>>
>>>>>> End the result would be different: all the instances with both graph
>>>>>> and database words. May you add the support for collections like you
>>>>>> already did with Spatial, please?
>>>>>>
>>>>>> *select from Class where props CONTAINSTEXT(false, true ) "graph
>>>>>>> database"*
>>>>>>>
>>>>>>> parse according the index configuration and looks for each words and
>>>>>>> return the records
>>>>>>> that al least contains one word
>>>>>>>
>>>>>>
>>>>>> Yes
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *select from Class where props CONTAINSTEXT(true, true ) "graph
>>>>>>> database" *
>>>>>>>
>>>>>>> parse according the index configuration and looks for each words and
>>>>>>> return the records
>>>>>>> that contains all the words parsed
>>>>>>>
>>>>>>
>>>>>> Yes
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2014-04-17 11:19 GMT+02:00 Luca Garulli <[email protected]>:
>>>>>>>
>>>>>>> So by default works like now. @Enrico, could you open an issue on
>>>>>>>> that?
>>>>>>>>
>>>>>>>> Lvc@
>>>>>>>>
>>>>>>>>
>>>>>>>> On 17 April 2014 11:04, Enrico Risa <[email protected]> wrote:
>>>>>>>>
>>>>>>>>> Sounds good to me
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 2014-04-17 10:47 GMT+02:00 Luca Garulli <[email protected]>:
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>> actually also operators can get parameters, so we could write
>>>>>>>>>> something:
>>>>>>>>>>
>>>>>>>>>> select from Class where props CONTAINSTEXT( <all>, <parseValue>
>>>>>>>>>> ) "graph database"
>>>>>>>>>>
>>>>>>>>>> Where:
>>>>>>>>>> - all, is a boolean to specify if we want all words matched
>>>>>>>>>> - parseValue, is a boolean to tell to parse the value or using
>>>>>>>>>> it as is
>>>>>>>>>>
>>>>>>>>>> Is it ugly?
>>>>>>>>>>
>>>>>>>>>> Lvc@
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 17 April 2014 10:39, Enrico Risa <[email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> I would leave the containsText as is now
>>>>>>>>>>> but now if you use containsText "graph databases" the operator
>>>>>>>>>>> looks for the entire string in the index.
>>>>>>>>>>>
>>>>>>>>>>> I could do one operator that take the string "graph databases"
>>>>>>>>>>> split according
>>>>>>>>>>> the fulltext index configuration and looks for the single string
>>>>>>>>>>> in the index.
>>>>>>>>>>>
>>>>>>>>>>> something like this
>>>>>>>>>>>
>>>>>>>>>>> select from Class where props matchText "graph database"
>>>>>>>>>>>
>>>>>>>>>>> and looks from "graph" and "database" in the index
>>>>>>>>>>>
>>>>>>>>>>> Would be good to support like a boolean that says if you are
>>>>>>>>>>> looking for all or at least one
>>>>>>>>>>> So with one operator we have cover both use cases
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> 2014-04-16 22:41 GMT+02:00 Luca Garulli <[email protected]>:
>>>>>>>>>>>
>>>>>>>>>>> +1. I would leave containsText as just one and containsTextAll
>>>>>>>>>>>> for all the words. Something like contains and containsAll.
>>>>>>>>>>>>
>>>>>>>>>>>> @Enrico, since you already contributed a lot on this, WDYT?
>>>>>>>>>>>>
>>>>>>>>>>>> Lvc@
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 16 April 2014 13:50, Riccardo Tasso <[email protected]>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks Enrico,
>>>>>>>>>>>>> it would be nice if the containsText operator could be used
>>>>>>>>>>>>> in conjunction with an array of strings, something like:
>>>>>>>>>>>>> WHERE label containsTextAll ["graph", "databases"]
>>>>>>>>>>>>> WHERE label containsTextOneOf ["graph", "databases"]
>>>>>>>>>>>>>
>>>>>>>>>>>>> Riccardo
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> 2014-04-16 13:42 GMT+02:00 Enrico Risa <[email protected]>:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hi Riccardo,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> you could try this query
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> select from Class where property containsText "graph" OR name
>>>>>>>>>>>>>> containsText "database"
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> With 1.7 snapshot you could also index the prefix of a word
>>>>>>>>>>>>>> https://github.com/orientechnologies/orientdb/
>>>>>>>>>>>>>> wiki/FullTextIndex
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I think there isn't an operator that does the split and
>>>>>>>>>>>>>> search each word
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 2014-04-16 12:24 GMT+02:00 Riccardo Tasso <
>>>>>>>>>>>>>> [email protected]>:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>>> let's say I have the following query: "graph databases"
>>>>>>>>>>>>>>> and I want to search for all the vertices with a label which
>>>>>>>>>>>>>>> contains at
>>>>>>>>>>>>>>> least one of the terms "graph" OR "database". This means that
>>>>>>>>>>>>>>> all the
>>>>>>>>>>>>>>> following labels are good: "I love graph databases", "I love
>>>>>>>>>>>>>>> databases", "I
>>>>>>>>>>>>>>> have a graph".
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Is it possible to use a OrientDB full-text index to perform
>>>>>>>>>>>>>>> this query? How?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Cheers,
>>>>>>>>>>>>>>> Riccardo
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ---
>>>>>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>>>>>> Google Groups "OrientDB" group.
>>>>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails
>>>>>>>>>>>>>>> from it, send an email to [email protected].
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ---
>>>>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>>>>> Google Groups "OrientDB" group.
>>>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from
>>>>>>>>>>>>>> it, send an email to [email protected].
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---
>>>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>>>> Google Groups "OrientDB" group.
>>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from
>>>>>>>>>>>>> it, send an email to [email protected].
>>>>>>>>>>>>>
>>>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>>
>>>>>>>>>>>> ---
>>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>>> Google Groups "OrientDB" group.
>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from
>>>>>>>>>>>> it, send an email to [email protected].
>>>>>>>>>>>>
>>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>>> ---
>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>> Google Groups "OrientDB" group.
>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from
>>>>>>>>>>> it, send an email to [email protected].
>>>>>>>>>>>
>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> ---
>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>> Google Groups "OrientDB" group.
>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>>> send an email to [email protected].
>>>>>>>>>>
>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>> ---
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>> Groups "OrientDB" group.
>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>> send an email to [email protected].
>>>>>>>>>
>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> ---
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "OrientDB" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to [email protected].
>>>>>>>>
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> ---
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "OrientDB" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to [email protected].
>>>>>>>
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "OrientDB" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>> --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "OrientDB" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected] <javascript:>.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OrientDB" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected] <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OrientDB" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.