Comments (8)
Ok, great. Oh yeah, and don't forget to order the results correctly. Something like:
$airports = Airport::whereIn('id', $result['ids'])->orderByRaw("FIELD (ID, $result['ids'])")->get();
because mysql doesn't keep the order when you use whereIn
And don't forget to star the package ;)
from tntsearch.
The demo page uses the search not the searchBoolean method, so try with:
$tnt->asYouType = true;
$result = $tnt->search($request->input('query'), 10);
Does this solve your issue?
from tntsearch.
Thank you, it did. I've just realized that I tried search()
method, but forgot to try it in conjunction with asYouType()
.
from tntsearch.
Great! Can you share some performance data, how long does the indexing take and how fast are the result queries? I'm just eager to know how it works on uses cases other than mine :)
from tntsearch.
I'm developing it locally on Homestead, so I guess it doesn't matter right now โ I'll remember to send you an email or mention here when the project goes live in a couple of months.
from tntsearch.
I'm running into a similar issue and am wondering if you could offer some advice.
I have two rows in my db that are getting indexed, with column values
- 3-(Trimethoxysilyl)propyl Acrylate
- Propylparaben
When I search for 'propyl' I only get the first result. When I search for 'propylp' I get the second result.
I looked at the query being executed when asYouType
is true and see this if I run it directly against the search index:
sqlite> select * from wordlist where term like 'propyl%' order by length(term) asc, num_hits DESC limit 1;
1168|propyl|1|1
If I modify the query slightly I see this, which looks like each is being treated as a separate word with 1 hit only:
sqlite> select * from wordlist where term like 'propyl%' order by length(term) asc, num_hits DESC;
1168|propyl|1|1
442|propylparaben|1|1
Is there something that could be happening when building the index that omits the 'propylparaben' hit from the 'propyl' wordlist since there is a space immediately following 'propyl'?
Thanks!
from tntsearch.
The words propyl
and propylparaben
are two different words that only share the same base which is propyl
. If we omit the LIMIT
clause like in your second example we could have performance problems with a larger dataset. Instead, we are returning the most frequent word that matches your base propyl
.
If you think you'll have a small dataset and won't run into performance problems, you can query the index wordlist table directly
from tntsearch.
Thanks for your response. I managed to come up with a solution that involves overriding several of the methods in TNTSearch.php. Is there a cleaner way to do this through the existing API?
from tntsearch.
Related Issues (20)
- tntsearch Deprecated: Creation of dynamic property HOT 1
- Anyone know what this random SMS-Texts file is? HOT 2
- Diacritic-Insensitive Search Support (Czech characters) HOT 3
- Scout: Custom tokenizer indexing properly to allow dashes and periods, but searching on dashes does not work HOT 9
- Performance issues with large datasets HOT 6
- Class 'TeamTNT\TNTSearch\Engines\Exception' not found in 'vendor/teamtnt/tntsearch/src/Engines/EngineTrait.php' line 46 HOT 1
- Per-Model Fuzzy Search Configuration in Laravel Scout HOT 1
- [FEATURE] Support of PSR-16 adapter
- How to add MYSQL_ATTR_SSL_CA option? HOT 1
- $startpos adjustment may return minus value. HOT 1
- How to update index for which no index.
- Fuzziness / Fuzzy-Search not working HOT 3
- Scout Driver - Model update or save dont trigger tntsearch index update HOT 3
- new TNTGeoIndexer expects engine
- Why add 'return' in saveHitList function? HOT 3
- Inaccurate results when searching two or more keywords. HOT 7
- In-depth Instructions HOT 1
- CLI re-index output is confusing
- How search with mysql and insensitive accents where 'a' = 'รก'
- How to perform a Boolean AND search with TNTSearch? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tntsearch.