Hi Shirley, Firstly, I’m sorry for not responding sooner. I’d say that this Google Group doesn’t get much traffic these days - but I’m also slack at responding to Github Issues as well. 😓
And also, I’m not sure if I have a particularly useful answer for you. Essentially, I think Sphinx is saying “all of these names have ’test’ within them, so they all have the same score”. The non-matching parts of the name likely don’t factor into things at all. One path to investigate could be to try different ranking algorithms and see if any give you a more useful variety of weights: https://freelancing-gods.com/thinking-sphinx/v5/searching#ranking Others have asked about weighting exact matches over partial matches, but I don’t feel there’s an easy solution on that front. https://sphx.org/forum/view.html?id=13222 Granted, it’s been a while, so maybe things have changed with Sphinx and/or Manticore that could provide a better matching approach - a lot of TS was written with Sphinx v2.2.11 in mind, and that was released in 2016. Again, apologies for the delay. — Pat > On 28 Mar 2025, at 08:49, Shirley Thompson <[email protected]> wrote: > > Hi, > > I'm using the global search functionality for two models with the classes > option: > > ThinkingSphinx > .search_for_ids( > classes: [Folder, Project], > conditions: { name: Riddle::Query.escape(search) }, > order: 'w DESC', > select: '*, weight() AS w', > star: true > ) > > However, when I inspect the weight for each result by doing > .pluck('sphinx_internal_class', 'name_sort', 'w'), it's not quite what I'm > expecting because they seem to be constant for each classes - the search > value was "test": > > [["Folder", "tEST", 1630], > ["Folder", "TEST!", 1630], > ["Folder", "TEST!!", 1630], > ["Folder", "testsssss", 1630], > ["Folder", "testsdafdsfdsfs", 1630], > ["Folder", "testshirley", 1630], > ["Folder", "testa", 1630], > ["Project", "Test Project", 1563], > ["Project", "TEST", 1563], > ["Project", "test", 1563], > ["Project", "TEST!", 1563], > ["Project", "TEST!", 1563], > ["Project", "tracking test", 1563], > ["Project", "TEST", 1563], > ["Project", "test", 1563], > ["Project", "test", 1563], > ["Project", "Duplicate of TEST!", 1563], > ["Project", "test", 1563], > ["Project", "test2", 1563], > ["Project", "test3333", 1563]] > > I also tested this with one class instead of two or even using the single > model syntax: Folder.search_for_ids but the weight is the same as above. Was > expecting the weight to differ depending on the name. > > Thank you in advance! > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion visit > https://groups.google.com/d/msgid/thinking-sphinx/a1636dcd-c494-40b9-9de7-cf13cad22f2dn%40googlegroups.com > > <https://groups.google.com/d/msgid/thinking-sphinx/a1636dcd-c494-40b9-9de7-cf13cad22f2dn%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/thinking-sphinx/465AB917-0F00-4EFA-8FDB-BCCD3CFD1651%40freelancing-gods.com.
