如何在ASP.NET和SQL服务器中实现关键字搜索 [英] How to implement keyword search in ASP.NET and SQL server
问题描述
大家好
我正在开展博客类项目,我需要设置搜索文章。
我正在使用sql server和asp.net。
我使用文章名称和一些与文章相关的关键字或标签设置了搜索。
我的问题是如何设置特定文章的关键字或标签列表
我尝试过:
我目前所做的是
srno | articlename |描述|关键字
1 | abc |完整的文章文本|一些相关的关键字
一个包含上述列的表格,其中可以搜索文章名称和关键字或标签。
我还将所有关键字或标签分开带分隔符,
关键字列表是每篇文章4-5个关键字或标签。每篇文章最多10个关键字或标签。
建议在博客表栏中使用关键字或标签
请告知
谢谢
Hi Everyone
I am working on a blog type project where I need to set up search for articles.
I am using sql server and asp.net.
I have set up search using article name and some keywords or tags related to the article.
My issue is how to set up keywords or tags list for a particular article
What I have tried:
What I have done currently is
srno | articlename | description | keywords
1 | abc | complete article text | some relevant keywords
A table with the above columns where articlename and keywords or tags will be searchable.
I also separated all keywords or tags with a delimiter ","
The keyword list is 4-5 keywords or tags per article. Max 10 keywords or tags per article.
Is it advisable to use keywords or tags in the blog table columns
Please advise
Thankyou
推荐答案
不确定我是否理解你的问题但是:
- 为什么要将标签/关键字存储在一个列中?我会将它们分成不同的行。将它们存储为以逗号分隔的列表会导致逻辑和性能方面的问题
- 根据定义,标签代表与关键字不同的东西。标签通常归类,而关键字是文章中存在的重要单词。
- 为什么不将两者都存储在同一个表中。两者都是单词,但只是不同的类型,所以通过添加一个类型列,你可以将它们分开
Not sure if I understand your question correctly but:
- Why do you store the tags/keywords inside a single column? I would split them into separate rows. Storing them as comma separated list will cause you problems in both logic and performance
- Depending on the definition tags represent a different thing than keywords. Tags typically categorize while keywords are important words that exist in the article
- Why not store both in a same table. Both are words but just different types so by adding a type column you can separate them
这篇关于如何在ASP.NET和SQL服务器中实现关键字搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!