Django-haystack搜索#hashtag [复制]

时间:2022-03-23 23:47:56

This question already has an answer here:

这个问题在这里已有答案:

I really have 0 experience in Haystack, but we use django-haystack for our search. For now the search works fine, but I just added #hashtags to the site and I would like the search to work somehow different for hashtagged words.

我真的有干草堆的经验,但我们使用django-haystack进行搜索。目前搜索工作正常,但我刚刚将#hashtags添加到网站,我希望搜索工作以某种方式不同的哈希标记的单词。

What I have right now:

我现在拥有的:

  • The results of searching for "pizza" and "#pizza" are the same, I think this is happening because "#" is being omitted in the search as a character.
  • 搜索“pizza”和“#pizza”的结果是相同的,我认为这是因为“#”在搜索中被省略为字符。

What I want to accomplish:

我想要完成的事情:

  • The results of searching for "#pizza" should only containt the text "#pizza".
  • 搜索“#pizza”的结果应仅包含文本“#pizza”。

Hope anyone can help me

希望有人能帮助我

1 个解决方案

#1


1  

Other people have modified WordDelimiterFilterFactory and WordDelimiterFilter to handle @ and #-characters as digits. Maybe that can work for you too?

其他人修改了WordDelimiterFilterFactory和WordDelimiterFilter来处理@和#-characters作为数字。也许这对你也有用吗?

#1


1  

Other people have modified WordDelimiterFilterFactory and WordDelimiterFilter to handle @ and #-characters as digits. Maybe that can work for you too?

其他人修改了WordDelimiterFilterFactory和WordDelimiterFilter来处理@和#-characters作为数字。也许这对你也有用吗?