Hi,
  assume you have the following record:
#1:1, "houston, texas, united states"

If there is no index the semantics of CONTAINSTEXT will iterate over all
the records returning only those wich contains the substring, hence:
SELECT FROM V WHERE txt CONTAINSTEXT "united s"
will return: #1:1

If there is a FULLTEXT index it will contain something like:
"houston", #1:1
"texas", #1:1
"united", #1:1
"states", #1:1

In this case when you use the CONTAINSTEXT operator, orientdb will search
the existence of your query string as a key over the FULLTEXT index, hence:

SELECT FROM V WHERE txt CONTAINSTEXT "united s"
will return: NOTHING (since in the index there isn't any key equals to
"united s")

SELECT FROM V WHERE txt CONTAINSTEXT "united"
will return: #1:1

If you have a FULLTEXT index you can always search a substring, with LIKE
operator:
SELECT FROM V WHERE txt like "%united s%"
will return: #1:1
But remember than in this case you wouldn't benefit of the index.

Cheers,
   Riccardo




2015-01-07 9:17 GMT+01:00 coach3pete <[email protected]>:

> Thanks Luigi,
> Just started using it since the post. Faster and more powerful...but still
> trying to understand the search behavior. Thanks again.
>
> On Jan 7, 2015, at 12:30 AM, Luigi Dell'Aquila <[email protected]>
> wrote:
>
> Hi Erik,
>
> fulltext index is a very basic implementation of a full text search
> (probably it will be discontinued in next releases), it just splits
> sentences in words based on blank spaces and then performs search on single
> words, so if you use more than a word in a "containstext" constraint, it
> will not return any results.
> I suggest you to use a Lucene index to have better indexing, more
> flexibility and much better performance
>
>
> http://www.orientechnologies.com/docs/last/orientdb-lucene.wiki/Full-Text-Index.html
>
> Luigi
>
>
> 2015-01-07 5:12 GMT+01:00 Erik Peterson <[email protected]>:
>
>> Correction. Works without fulltext index. Fails with fulltext index.
>>
>>
>> On Tuesday, January 6, 2015 8:54:52 PM UTC-7, Erik Peterson wrote:
>>>
>>> I have a simple class geo with location property with string items like
>>> "united states"
>>> "houston, texas, united states"
>>> ...
>>>
>>> select geo where location containstext "united"
>>> Returns records as expected
>>>
>>> However...
>>>
>>> select geo where location containstext "united "
>>> select geo where location containstext "united s"
>>> select geo where location containstext "united states"
>>> etc.
>>> Does not return records as expected. No records are returned.
>>>
>>> Why?
>>>
>>> Same behavior with and without index.
>>>
>>>
>>>
>>>
>> --
>>
>> ---
>> 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 a topic in the
> Google Groups "OrientDB" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/orient-database/yroAgjsFpaI/unsubscribe.
> To unsubscribe from this group and all its topics, 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.

Reply via email to