Semantic-Org / Semantic-UI

Semantic is a UI component framework based around useful principles from natural language.
http://www.semantic-ui.com
MIT License
51.12k stars 4.94k forks source link

[Search] Allow query terms to match each word #1707

Closed MRezaSafari closed 9 years ago

MRezaSafari commented 9 years ago

Hello ,

i have almost 4000 record and i want to use the ui.search functionality to have a full text search on them . there is no problem , search is working perfectly and fast . ( i export them as json data and use the json data to search ).

take this as an example :

var Records = [

    {id: '1', title: 'Hello There how are you', description: 'ask me'},
    {id: '2', title: 'lorem ipsum is fine but not always', description: 'ask me'},
    {id: '3', title: 'my name is reza and im 24 year old', description: 'ask me'},
    {id: '4', title: 'that guy name is michele', description: 'ask me'},
    {id: '5', title: 'oh i see some snow out there', description: 'ask me'},

]

and have this for calling this :

$('.ui.search')
  .search({
      source: content,
      cache: true,
      searchFields: [
        'title', 'id'
      ],
      searchFullText: true
  })
;

so , as you see here i do the search in title and id . now take this queries as an example

  1. Hello There result : Hello There how are you
  2. Name is result : my name is reza and im 24 year old, that guy name is michele
  3. name reza result : none
  4. name michele result : none
  5. name + reza + 24 result : none

look at those last three queries . how can i make this happen ? like the google , we use + to attach words together .

MRezaSafari commented 9 years ago

is it going to be around soon ?

jlukic commented 9 years ago

I have to evaluate the complexity. Currently everything occurs in one regexp match per field which is pretty quick. Increasing the time per record will have implications on large datasets.

agborkowski commented 9 years ago

tip full text js engine

@source http://lunrjs.com/

jlukic commented 9 years ago

Thanks @agborkowski useful for me, i was unfamiliar with steming and stop words. These seem like interesting enhancements for search, although it appears will probably cost about 5-10kb of filesize to add.

jlukic commented 9 years ago

Pushing this back to 1.10 not enough time this release

MRezaSafari commented 9 years ago

i think you should consider adding this as a plugin and not in the core . the core function is good for public , try to release this enhancement as plugin .

jlukic commented 9 years ago

The use of meta characters like "+" to separate words will probably not come for a bit.

As a consolation i've added an implementation of fuzzy search as the new full text search algorithm.