Open dirkjf opened 6 years ago
I did some tests, and came up with the following:
$indexer = $tnt->createIndex('name.index');
$indexer->query('SELECT concat(\'album_\',id) as id, artist, title, year FROM albums;');
$indexer->run();
$indexer->query('SELECT concat(\'artist_\',id) as id, name FROM artists;');
$indexer->run();
Now the result has info about the originating tables:
array:3 [
"ids" => array:4 [
0 => "album_1"
1 => "album_2"
2 => "artist_1"
3 => "artist_2"
]
"hits" => 4
"execution_time" => "1.523 ms"
]
Anyone of the developers, is this the way to go? I do not see any other solution at first glance.
I am also looking for this type of interface... searching against multiple/many indexed models at once and getting mixed results, without re-assembling from disparate search indeces by hand. Note that I am not looking for faceted search/browsing, that's a different use case.
Point of reference: in the context of Laravel Scout with the Algolia driver, this is achieved via 'Aggregators'.
First of I want to say thank you for creating this and making it available. I am using this in a symfony application and it is working quite well.
There is one thing I did not achieve in a way I wanted, and I think it might not be possible currently. It's about indexing multiple tables in one index and showing the mixed results. I am not the first one with this issue. This has been noted before in #100, #117 and #135.
When working with one index for multiple tables, the corresponding IDs are no longer corresponding because you will have for example and ID '14' in multiple tables. Since TNTsearch only returns an ID there is no way of knowing which table this ID belongs to.
When working with multiple indexes you cannot combine the results. You could put them under each other or use a faceted search, But what if you would like to combine the results?
I think there are two possible solutions:
Am I overlooking something? Please let me know.