This gives me the count AFTER pagination is applied...
count($context['topics'])
Is the total already available or will it require a SQL edit? Something like...
COUNT(*) AS [icode]total_count[/icode]
thanks
I guess you want it in the template, right?
It is not passed there.
With some tricks you could extract an approximation from the paginations, but to get the exact number of results, you have to edit Search.controller.php and assign the value of $num_results to an index in $context.
How do you calculate the relevance? :D
Table: elkarte_log_search_results has a relevance column :D
re: relevanceI was surprised it wasn't output to the search-results page already. I'm going to go back to this and expose the search-weight settings as well. That info would be, um,
relevant to the semantic value for the
schema:SearchAction (https://schema.org/SearchAction)'s query (https://schema.org/query) property's -output constraints (https://schema.org/docs/actions.html#part-4).
Search is Spuds' domain. xD
Good stuff ... I think adding Structured Data would be a very good thing to do in 2.0.
I've dabbled with it, but only using ld+json output in the templates, and then only for the topic listing, never considered getting in to the other templates such as search. What is the benefit of using it on the search page (honest question).
The benefits of linked-data, first, let's hear from the man himself.
https://www.youtube.com/watch?v=OM6XIICm_qo&t=18s
k, posting that real quick and typing my 2cents to append here (which should answer your question and hopefully demystifies linked-data for everyone). ...to be continued...
Expanding upon that. So the web is a decentralized documentation system, right? Well, linked-data is a decentralized database, a hierarchy of concepts, a built-in
axiomatic proofing system (https://en.wikipedia.org/wiki/Axiomatic_system), the definitive answer to localization (https://en.wikipedia.org/wiki/Internationalization_and_localization).
Machines are dumber-than-children idiots, incapable of abstract concepts, a process which we take for granted. But, if we define our objects (and link them together with relationships), machines are able to reason.
Without semantics, this is simply a block of text which is full-text searched by Google matching only the literal characters of the text, i.e. an exact-word match.
but with semantics:
A machine can take this minimum input... And can produce this output about Jill on its own: as a fact, and this as a guess...
which is a different outcome from
And that's not even scratching the surface of the benefits, many of which are unknown until we reach a certain point in world-wide implementation (like we did with the old web).
Had much more to say about it but gotta roll, but specifically about the search/search-results pages...
Search is the most important feature of ANY site (and the web itself, for that matter), it's what we do the most online. The search feature is undoubtedly the best entry point to (potentially) any piece of data in its scope. So, in my estimation it's the best place to apply my semantic-efforts.
Also, there's Google's "Sitelinks Searchbox (https://developers.google.com/search/docs/data-types/sitelinks-searchbox)" --but just because you have the correct markup for the schema:SearchAction (and mine is correct and then some), doesn't mean you'll get the Searchbox in your SERs, there are still many factors weighing your relevancy to the user's search. Regardless, it's an in-the-wild example of what is possible with this technology.
tl;d review
More about linked-data from one of the author's of JSON-LD.
https://www.youtube.com/watch?v=4x_xzT5eF5Q
Btw, you've been using a semantic search via Google (https://en.wikipedia.org/wiki/Google_Hummingbird) since Aug. 2013
If I'm not wrong, you may have it in either:
$message['first_post']['time']
$message['first_post']['html_time']
$message['first_post']['timestamp']
Blame me for looking at 1.1 code instead of 1.0... sorry for the noise. xD
Re: Search
There are a handful of situations where two search <form>s are in the same page (search page), the quicksearch and the advanced search. I'm adding a conditional statement to remove the quicksearch when the advanced is loaded. I'm going to double-check all the semantic markup i've added to make sure everything is pointing to the right <form> under the right condition. Perhaps a little eye-candy for the user here, something like, idk, a faux-quicksearch <form> shrinking on the page until it disappears while the advanced-search <form> expands open. And of course the real quicksearch <form> will need a transformation reappearing when the user leaves the search-form page. idk it'd be kewl.
Re: Search (update)updated again, i
think this includes all instances of two search <form>s
themes/default/index.template.phpif((($context['current_action'] == 'search') && (!isset($context['get_topics'][1]))) || (($context['current_action'] == 'search') && (isset($context['did_you_mean']) || empty($context['topics'])))){
}else{
echo 'HTML for the quicksearch <form>';
}
A bit more details may help, it may be it's quite late at night, but I'm not sure what you want to do, sorry... :(