teamtnt / laravel-scout-tntsearch-driver

Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch
MIT License
1.1k stars 144 forks source link

Fuzzy doesnt works as expected #159

Closed kiankji closed 3 months ago

kiankji commented 6 years ago

I have a model where username and id was indexed. My tntsearch looks like that:

    'tntsearch' => [
        'storage'  => storage_path(), //place where the index files will be stored
        'fuzziness' => env('TNTSEARCH_FUZZINESS', true),
         'fuzzy' => [
            'prefix_length' =>2,
            'max_expansions' => 60,
            'distance' => 2
        ],
        'asYouType' => false,
        'searchBoolean' => env('TNTSEARCH_BOOLEAN', false),
    ],

I got 50 entries and two of them are

array:2 [▼
  0 => array:9 [▼
    "id" => 1
    "uuid" => "550e8400-e29b-11d4-a716-446655440000"
    "username" => "test"
    "created_at" => "2018-04-05 08:00:00"
    "updated_at" => "2018-04-05 03:00:00"
    "deleted_at" => null
  ]
  1 => array:9 [▼
    "id" => 52
    "uuid" => "dd191c20-32a1-4357-9298-5e4372618adf"
    "username" => "test1"
    "created_at" => "2018-05-10 05:25:27"
    "updated_at" => "2018-05-10 05:33:30"
    "deleted_at" => null
  ]
]

If i type "test","tes",te" or "t" just the first of the both entry appears but if i type tester both appear. How can i fix it that every entry appears thats got e.g. a "t" in it?

Thanks