Возникла проблема с Sphinxql. Я пытаюсь сопоставить несколько полей и дать каждому вес.
select id
,item
,param1
,param2
,module_id
,param2_id
,date_change
,custom_rank
,weight() as rank
,in(site, 336935152)
and if(date_from, date_from, 1578400079) <= 1578400079
and if(date_to, date_to, 1578400079) >= 1578400079
and ((((module_id = 3674251022)and(param1_id = 455881287)and(param2_id = 4196041389)))) as cond1
,if(date_to, date_to, 1578400079) date_to_nvl
,if(date_from, date_from, 1578400079) date_from_nvl
from index
where MATCH('@(title,body) (search query)')
limit 0, 500
option max_matches = 500
,field_weights=(title=99999, body=1)
Но вес не имеет значения. Даже если я присваиваю 99999
вес заголовку и 1
телу и наоборот, результат запроса не изменится. Моя цель - создать сфинкса, сначала сопоставить заголовок и после тела.
UPD: packedfactors()
результат запроса
+------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | weight() | packedfactors() |
+------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 1055 | 1000631 | bm25=631, bm25a=0.650515, field_mask=3, doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1, tf_idf=0.158041, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), field1=(lcs=1, hit_count=5, word_count=1, tf_idf=0.790203, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=3, min_best_span_pos=3, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), word0=(tf=6, idf=0.158041) |
| 1056 | 1000631 | bm25=631, bm25a=0.650515, field_mask=3, doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1, tf_idf=0.158041, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), field1=(lcs=1, hit_count=5, word_count=1, tf_idf=0.790203, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=3, min_best_span_pos=3, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), word0=(tf=6, idf=0.158041) |
| 242 | 1000627 | bm25=627, bm25a=0.649095, field_mask=3, doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1, tf_idf=0.158041, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), field1=(lcs=1, hit_count=4, word_count=1, tf_idf=0.632162, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), word0=(tf=5, idf=0.158041) |
| 813 | 1000627 | bm25=627, bm25a=0.649095, field_mask=3, doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1, tf_idf=0.158041, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), field1=(lcs=1, hit_count=4, word_count=1, tf_idf=0.632162, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), word0=(tf=5, idf=0.158041) |
| 815 | 1000627 | bm25=627, bm25a=0.649095, field_mask=3, doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1, tf_idf=0.158041, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), field1=(lcs=1, hit_count=4, word_count=1, tf_idf=0.632162, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), word0=(tf=5, idf=0.158041) |
| 1054 | 1000627 | bm25=627, bm25a=0.649095, field_mask=3, doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1, tf_idf=0.158041, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), field1=(lcs=1, hit_count=4, word_count=1, tf_idf=0.632162, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), word0=(tf=5, idf=0.158041) |
| 334 | 1000621 | bm25=621, bm25a=0.647014, field_mask=3, doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1, tf_idf=0.158041, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), field1=(lcs=1, hit_count=3, word_count=1, tf_idf=0.474122, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), word0=(tf=4, idf=0.158041) |
| 335 | 1000621 | bm25=621, bm25a=0.647014, field_mask=3, doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1, tf_idf=0.158041, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), field1=(lcs=1, hit_count=3, word_count=1, tf_idf=0.474122, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), word0=(tf=4, idf=0.158041) |
| 510 | 1000621 | bm25=621, bm25a=0.647014, field_mask=3, doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1, tf_idf=0.158041, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=8, min_best_span_pos=8, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), field1=(lcs=1, hit_count=3, word_count=1, tf_idf=0.474122, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=10, min_best_span_pos=10, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), word0=(tf=4, idf=0.158041) |
| 1057 | 1000621 | bm25=621, bm25a=0.647014, field_mask=3, doc_word_count=1, field0=(lcs=1, hit_count=1, word_count=1, tf_idf=0.158041, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), field1=(lcs=1, hit_count=3, word_count=1, tf_idf=0.474122, min_idf=0.158041, max_idf=0.158041, sum_idf=0.158041, min_hit_pos=1, min_best_span_pos=1, exact_hit=0, max_window_hits=1, min_gaps=0, exact_order=1, lccs=1, wlccs=0.158041, atc=0.000000), word0=(tf=4, idf=0.158041) |
+------+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+