Solr拼写检查配置(Solr spellcheck configuration)
我正在尝试使用IndexBasedSpellChecker构建拼写检查索引
<lst name="spellchecker"> <str name="name">default</str> <str name="field">text</str> <str name="spellcheckIndexDir">./spellchecker</str> </lst>
我想指定动态字段“* _text”作为字段选项:
<dynamicField name="*_text" stored="false" type="text" multiValued="true" indexed="true">
怎么做?
I am trying to build the spellcheck index with IndexBasedSpellChecker
<lst name="spellchecker"> <str name="name">default</str> <str name="field">text</str> <str name="spellcheckIndexDir">./spellchecker</str> </lst>
And I want to specify the dynamic field "*_text" as the field option:
<dynamicField name="*_text" stored="false" type="text" multiValued="true" indexed="true">
How it can be done?
原文:https://stackoverflow.com/questions/3004823
最满意答案
一些东西:
首先,如果要访问超过一半的数据块,则完全扫描会更快,因为读取索引块是另一个IO调用,因此读取索引行的时间通常是读取连续行的两倍。
其次,无论是否有索引,您都需要查看您的计划。 这里将提供信息,让您知道改变了什么。 如果你看到“Merge Join Cartesian”,那么规划师就会出错。 那个计划永远不会好。 完全扫描的内部循环具有相同的IO成本,但占用的内存和临时空间更少。
第三,你使用ANALYZE TABLE构建了统计数据。 别。 甚至甲骨文也表示它很糟糕而且很糟糕。 使用dbms_stats包来构建统计数据,您将获得更准确的统计数据。 如果它仍然是奇数,请更改样本大小,或执行完整统计而不是估计。
A few things:
First, if you are accessing over half of the data blocks, full scan will be faster because reading the index block is another IO call, so the read of an indexed row is generally twice as expensive time wise as reading a sequential row.
Second, you need to look at your plans with and without the index. There will be information here that will let you know what changed. If you see a "Merge Join Cartesian" the planner has made an error. That plan is NEVER good. Inner loops of full scans have the same IO cost, but take less memory and temp space.
Third, you built stats with ANALYZE TABLE. Don't. Even Oracle says it is bad and broken. Use the dbms_stats package to build your stats, and you will get more accurate stats. If it is still odd, change your sample size, or do full stats instead of estimated.
相关问答
更多-
由于查询性能下降?(performance degraded due to query?)[2024-04-27]
尝试创建索引,如下所示,然后查看EXPLAIN计划 CREATE INDEX idx_order_date_user_id ON carts_archive(order_date,user_id); Try creating index as below and then see EXPLAIN plan CREATE INDEX idx_order_date_user_id ON carts_archive(order_date,user_id); -
是否会按照DTA的建议添加不支持的索引来提高性能?(Will adding a NONCLUSTERED INDEX as suggested by DTA improve performance?)[2023-07-18]
在分析索引时很难说DTA是错误的,因为我不知道数据分布,但确实如此,但我在主键之外添加的第一个索引是SHOP.CityID上的(可能是复合的)索引。 SHOP.Active 。 没有测试,我不能给你任何绝对,但这是推理。 由于您基本上是在SHOP上进行过滤并且在任何其他表上都没有过滤器,因此查询的大量提升很可能是在SHOP过滤50M行。 如果数据库开始从任何其他表加入,则未过滤的连接将导致针对CITY 3M行,并且从过滤SHOP开始将极有可能导致更少的数量。 有充分理由,编译器喜欢“更少”。 这是SHOP上 ... -
在您选择的列上添加索引会加快查询速度吗?(Does adding an index on the column you are selecting speed up the query?)[2023-08-27]
如果您始终按tag搜索,则只需索引tag列。 在未使用时将列添加到索引,在插入或更新记录时会引入不必要的开销,并且还会占用更多存储空间。 但是复合索引( tag , site )可能会提供额外的优化,因为MySQL只需要读取索引来满足您的查询( EXPLAIN通常将此优化标记为using index )。 如果您的操作主要是读取而不是写入,那么使用复合索引可能不是一个坏主意。 如果tag列具有高基数会更好,这意味着它们的值很可能在每行之间不同。 但我建议你先咨询EXPLAIN输出。 If you alway ... -
尝试为字段“batch_no”创建索引,因为查询正在此字段中进行搜索。 PS:使用desc索引,因为搜索是最大值 try to create an index for the field "batch_no", because the query is doing a search in this field. PS : Use a desc index, because the search is for the max value
-
我期望以下多列索引是最快的: CREATE INDEX orders_foo_idx ON orders (total DESC, client_id); PostgreSQL 9.2可能会受益匪浅。 由于它是“仅索引元组”功能,它可以在有利的情况下为查询提供查询而不会碰到表格:自上次VACUUM以来没有写入。 在这种情况下, DESC或ASC几乎不重要。 B树索引可以在两个方向上搜索几乎同样有效。 I would expect the following multicolumn index to be ...
-
在企业版中,您可以进行在线索引操作。 它看起来像这样: create index MyIDX on MyTable (MyColumn) with (online = on) 请注意,该操作在该过程中(在开始和结束时,IIRC)仍然会进行一些锁定,但在索引创建期间不锁定该表。 如果您担心,请在非生产环境中启动扩展事件会话,并跟踪创建索引时创建的锁和创建多久的锁。 更新: 文档中有关于在线和离线操作时都保持什么锁的相当好的说明。 In Enterprise Edition, you gain the abi ...
-
一些东西: 首先,如果要访问超过一半的数据块,则完全扫描会更快,因为读取索引块是另一个IO调用,因此读取索引行的时间通常是读取连续行的两倍。 其次,无论是否有索引,您都需要查看您的计划。 这里将提供信息,让您知道改变了什么。 如果你看到“Merge Join Cartesian”,那么规划师就会出错。 那个计划永远不会好。 完全扫描的内部循环具有相同的IO成本,但占用的内存和临时空间更少。 第三,你使用ANALYZE TABLE构建了统计数据。 别。 甚至甲骨文也表示它很糟糕而且很糟糕。 使用dbms_st ...
-
DROP INDEX 完全降低了索引。 事务必须在新查询生效之前提交,但这通常不是问题。 您可能正在看到其他测试工件,例如: 统计数据略有变化后,Postgres会翻转到其他查询计划。 这表明您的费用设置可能不合适或其他一些不良配置。 重复执行查询已填充缓存(这可能对大表产生很大影响)。 对于中途可比较的结果,所有候选人都会进行几次。 您的查询基于“最后十分钟”。 可以有1000行,10分钟后,可以只有1.可以产生很大的不同。 询问 对于初学者,删除完全不必要的部分: SELECT COUNT(*) AS ...
-
使用索引提高性能(Improve performance by using index)[2022-06-09]
最后,我找到了在很短的时间内完成此查询的方法! 查询是: select distinct (B.NameDastgahID), B.ZarfiateHmaleBar, B.ShomarePelak, B1.NameDastgahTitle, B2.NameKhodroTitle, B3.NoeKhodroTitle, B4.KarbarieKhodroTitle, B5.ShahreKhodroTitle from dw.bohran_fct_etelaatenavegankhodroyi B INNE ... -
如果不使用“ORDER BY”,运行查询需要多长时间? 如果大约相同的时间,则查询没有优化可能性。 (也许投资更好的硬件/更快的磁盘 - 或调整你的mysql服务器值进行优化?) 如果它快得多,您可以尝试在tblProduct.ProductName上创建索引。 但是,如果这有帮助的话,不是不可取的 How long does it take to run the query if you do not use "ORDER BY"? If this is about the same amount of ...