As designed Bug reported in Enhanced Search Results for post result when post is first post of thread.

Reid2

Member
Affected version
XF 2.1.2 XF Enhanced Search 2.1.1 PHP 7.3.5 Elastic Search 6.3.2
The search function displays post result rows for posts that contain the search term, except when the post is the first post in a thread, in which case it only displays a thread result row. My understanding is that the thread result row should only be displayed when the search term is found in the title of the thread. This should have nothing to do with what is found in the first post of a thread. It should display a post result row for all posts which contain the search term. Please correct this error in your logic handling of the search results. Thank you and best wishes.

I would like to add that we got the same result on our production system and our test system (after completely rebuilding the search indices).
 
Last edited:
If a post is the first within the thread then it is inserted into the search index specifically as a thread, rather than a post. This is intended.
 
@Reid2 to bring the discussion back to the original thread, please see above.

Your report seems to be erroneous. Or are we missing something?
 
We wrote an addon to display the search result posts. This depends upon the search result creating a post result row. When the first post of a thread contains the search result hit text, the search results do not produce a post result row. Instead, it produces a thread result row. This means we can't display the first post in a thread when it results in a hit. The first post in a thread should produce the same data as all the other posts in that thread.

In addition, and probably on another topic, I have noticed that if I delete the first post in a thread, it deletes the entire thread. Again, this should not happen. You should allow the first post in a thread to be deleted without deleting the rest of the thread. I suspect the designers took a shortcut here and made the first post in the thread represent the entire thread and that is causing both problems.

I hope I have made this more clear to the designers and people who have to repair errors.
Thanks for your time and effort. XenForo is clearly a superior product; but even the best always have room for improvement.
 
It has occurred to me that I might have been slightly ambiguous in my description of the intended output from search. I want to list not a list of links to posts which match the search; but all the found posts listed just as if they had been in the same thread and fully displayed for each post. I intend that members will not have to click on any links unless a particular post contains a link they need to use. This saves an enormous amount of time for the members who use the search. The way it was before we started, the members had no choice but to click on every link to each post to see if it contains anything of use. I hope this has shed the proper light on the issue. Again, thank you for considering this problem. :)
 
If a post is the first within the thread then it is inserted into the search index specifically as a thread, rather than a post. This is intended.

Hi Chris,

I'm running into the same issue with one of my new add-ons currently being developed. Is there any way you can change the design so that the first post of a thread is indexed as a post and not as a thread.

Thank you.
 
No, sorry.

The first post of a thread IS the thread and it will be indexed as such. The same logic is used in other places and will continue to do so.

I’m really not seeing any issue here.

The post search result and the thread search result are the same. I’m not really comprehending what the issue is.
 
In addition, and probably on another topic, I have noticed that if I delete the first post in a thread, it deletes the entire thread. Again, this should not happen. You should allow the first post in a thread to be deleted without deleting the rest of the thread.
I wholeheartedly disagree :)

The majority of threads does not make any sense without the first post which does contain te question(s) or topic to discuss.
If you delete this post, the answers loose their context and are not useful any longer.
So if the first post is deleted, the thread itself normally should also be deleted as well.
There are edge cases where this general assumption might not fit, in those cases you can just split out the first post to a different thread.
 
Last edited:
Not all threads depend on the first post. It depends on the purpose of posting. Many threads have posts which are unrelated except to the poster. If the first post breaks a site rule and the rest do not, it does not follow that the entire thread be lost. This might be true if all following posts depend on the first post being present. You must live in a world where there is only black and white. There are other people and other ideas. This is not a case of only one can be right. There is a win-win here if you look for it.
 
The post search result and the thread search result are the same. I’m not really comprehending what the issue is.

I'm wanting to get all post IDs with keywords in a post. I would like only post IDs, I don't want the search to include any thread titles. Is this possible?
 
Not a change we’re going to be making so you would be better off posting for help in the dev discussions forum.
 
Back
Top Bottom