solr使用edismax进行分页时返回重复记录

时间:2012-09-17 15:42:40

标签: solr pagination

我正在使用solr 3.5并在分页时遇到奇怪的行为。在分页时,solr会返回一些相同的记录/文档;例如,我在第一页获得了一个文档,我在第三页中获得了相同的文档。排除故障后,我意识到使用edismax查询解析器时Solr的行为与此类似。使用默认解析器时,分页效果很好。任何想法为什么??

下面的

是每个分页页面的解码查询

第1页

spellcheck=true&spellcheck.onlyMorePopular=false&spellcheck.extendedResults=true&spellcheck.count=1&spellcheck.collate=true&q=coffee AND countryId:1&defType=edismax&start=0&rows=10&fl=outletId,outletPhone1,outletPhone2,outletPhone3,outletUrl,outletGpsLatitude,outletGpsLongitude,outletAddress,outletPrimaryName,outletSecondaryName,brateCount,brateit_review,views,outletAvarageRating,outletRatingId,outletRatingValue,poBox,locatedInOutletId,locatedInOutletPrimaryName,locatedInOutletSecondaryName,locatedInName,floor,addressPlaceId,addressPlaceName_en,streetId,streetName_en,areaId,areaName_en,cityId,cityName_en,countryId,countryCode,countryName_en,plsId,plsName_en,categoryId,categoryName_en,ratingId,ratingName_en,primaryCategoryId,primaryCategoryName_en,primaryIndustryId,primaryIndustryName_en&facet=true&facet.limit=-1&facet.sort=count&facet.mincount=1&facet.field=facetCityName_en&facet.field=facetPoolCategory_en&facet.field=facetAreaName_en&sort=score desc, outletAvarageRating desc,brateCount desc,views desc,random_1347951132109 desc

第2页

spellcheck=true&spellcheck.onlyMorePopular=false&spellcheck.extendedResults=true&spellcheck.count=1&spellcheck.collate=true&q=coffee AND countryId:1&defType=edismax&start=10&rows=10&fl=outletId,outletPhone1,outletPhone2,outletPhone3,outletUrl,outletGpsLatitude,outletGpsLongitude,outletAddress,outletPrimaryName,outletSecondaryName,brateCount,brateit_review,views,outletAvarageRating,outletRatingId,outletRatingValue,poBox,locatedInOutletId,locatedInOutletPrimaryName,locatedInOutletSecondaryName,locatedInName,floor,addressPlaceId,addressPlaceName_en,streetId,streetName_en,areaId,areaName_en,cityId,cityName_en,countryId,countryCode,countryName_en,plsId,plsName_en,categoryId,categoryName_en,ratingId,ratingName_en,primaryCategoryId,primaryCategoryName_en,primaryIndustryId,primaryIndustryName_en&facet=true&facet.limit=-1&facet.sort=count&facet.mincount=1&facet.field=facetCityName_en&facet.field=facetPoolCategory_en&facet.field=facetAreaName_en&sort=score desc, outletAvarageRating desc,brateCount desc,views desc,random_1347951219828 desc

第3页

spellcheck=true&spellcheck.onlyMorePopular=false&spellcheck.extendedResults=true&spellcheck.count=1&spellcheck.collate=true&q=coffee AND countryId:1&defType=edismax&start=20&rows=10&fl=outletId,outletPhone1,outletPhone2,outletPhone3,outletUrl,outletGpsLatitude,outletGpsLongitude,outletAddress,outletPrimaryName,outletSecondaryName,brateCount,brateit_review,views,outletAvarageRating,outletRatingId,outletRatingValue,poBox,locatedInOutletId,locatedInOutletPrimaryName,locatedInOutletSecondaryName,locatedInName,floor,addressPlaceId,addressPlaceName_en,streetId,streetName_en,areaId,areaName_en,cityId,cityName_en,countryId,countryCode,countryName_en,plsId,plsName_en,categoryId,categoryName_en,ratingId,ratingName_en,primaryCategoryId,primaryCategoryName_en,primaryIndustryId,primaryIndustryName_en&facet=true&facet.limit=-1&facet.sort=count&facet.mincount=1&facet.field=facetCityName_en&facet.field=facetPoolCategory_en&facet.field=facetAreaName_en&sort=score desc, outletAvarageRating desc,brateCount desc,views desc,random_1347951286359 desc

1 个答案:

答案 0 :(得分:0)

问题在于我的排序实现。我在每个页面上按随机字段排序,导致文档在页面之间不断移动。

String randomField = random_"+ (new Date()).getTime();