Tags + Relevance

zankoo

Really Experienced
CHYOA Backer
Preface: I did a little searching for old threads on this topic, and didn't find what I was looking for ... though maybe that's kind of meta, since my issue is about how the search functions on the site work.

When searching for content, I understand most of it, but I don't know how "relevance" functions as a criteria. Is there a formula? Is there an algorithm?

Would love to learn more. Thanks!
 
With "sort by" set to "Relevance," the search counts how often any search term is found in the relevant records.

The higher the count, the earlier the result will be shown in the list.


There are operators that can be used with search terms to modify how each term should be weighed.

boolean mode operators
e.g.
+term
-term
>term
<term
"term"
~term
 
With "sort by" set to "Relevance," the search counts how often any search term is found in the relevant records.
This is a fantastic theory and system. And because this is the internet and I've been on the planet for a long time, I've learned to doubt everything everyone tells me.

But if this is true, it's fascinating. Thank you.

--

EDIT: I just tested this a little bit, using the names of the two main characters of one of my stories, Abbie and Jake.

When I searched for "Abbie" in stories using relevance, my story ("Always, Abbie") was the first hit. When I searched for "Jake" the same way, my story (in which Jake appears in hundreds of chapters, his name used probably thousands of times) does not appear at all.

When I searched for "Abbie" in chapters using relevance, none of my chapters appeared at all, even though several of them have the name "Abbie" in the title, and almost all of them feature her name countless times.

This is all to say that I think maybe I still don't understand.
 
Well, the problem is that it doesn't search through all database columns of a story/chapter.
I think the only columns are chapter title and tag for chapters, and title, subtitle, synopsis, and tag for stories.

So if you search for
abbie
in chapters
https://chyoa.com/search?q=abbie's&type=chapter&sort=relevance
the first result is a chapter with "abbie" being part of the chapter title three times.
In most chapter titles, the term is only used once, so these chapters get the same value assigned and only one result gets pushed to the top.

If you search for
jake abbie
in chapters
https://chyoa.com/search?q=jake+abbie&type=chapter
the first result will be the one mentioned above as it has three hits, followed by chapters that got two hits.

If you search for
jake <abbie
in chapters
https://chyoa.com/search?q=jake+<abbie&type=chapter
the term "abbie" gets deprioritized, though the result with the three hits will still be shown first.
It is followed by results that contain jake twice. In the previous example, the search wouldn't make a difference between whether it was one abbie and one jake, two times abbie, or two times jake.


When I searched for "Jake" the same way, my story (in which Jake appears in hundreds of chapters, his name used probably thousands of times) does not appear at all.
The term "jake" doesn't appear in the mentioned columns at all.
If you search for
anything jokingly
https://chyoa.com/search?q=anything jokingly&type=story&sort=relevance
your story will appear at the top of the results.

When I searched for "Abbie" in stories using relevance, my story ("Always, Abbie") was the first hit.
That search will return only three results that have "abbie" in the mentioned columns. In your story, it appears three times, so your story is at the top.
 
Well, the problem is that it doesn't search through all database columns of a story/chapter.
I think the only columns are chapter title and tag for chapters, and title, subtitle, synopsis, and tag for stories.
Ooh, this is very cool!

Thank you so much for the extremely clear explanation! I really appreciate it.
 
There are operators that can be used with search terms to modify how each term should be weighed
!??? How did I not know about this until now!?

This changes everything! What do +term and ~term mean? Is the default search ORed? Is there a reference sheet for this somewhere?
 
Is the default search ORed?
Yes.

"term" must be found in the search result.
To do an AND search, you use
+term1 +term2

Is there a reference sheet for this somewhere?
It is used in SQL implementation for full-text search in boolean mode.
So you might find information about it in the manuals of the implementations.
sql boolean full-text search operators


Currently, there is still a bug that removes some of the operators when switching to the next page of search results. To prevent that from happening, you'd need to manually append the page information
Code:
&page=2
to the link in the address bar in your browser.
 
Yes.


"term" must be found in the search result.
To do an AND search, you use
+term1 +term2


It is used in SQL implementation for full-text search in boolean mode.
So you might find information about it in the manuals of the implementations.
sql boolean full-text search operators


Currently, there is still a bug that removes some of the operators when switching to the next page of search results. To prevent that from happening, you'd need to manually append the page information
Code:
&page=2
to the link in the address bar in your browser.

I'm still confused on how to search with multiple tags? Do I put this in the search bar?
"+tag1 +tag2"

Or am I supposed to modify the URL itself?
 
Last edited:
Or am I supposed to modify the URL itself?
You put the search term "+term1 +term2" into CHYOA's search bar.
This will work to get the first page of results. (Results 1 to 10)


If you then click on page 2 to get results 11 to 20, it returns the results 11 to 20 for "term1 term2". Adding "&page=2" in the address bar is only necessary for results 11 and up.


"+tag1 +tag2"
The search doesn't only search for "tags" but also in other fields.
So the "tag" in your example would rather be "term" or "keyword"
 
Back
Top