首页 > 解决方案 > SOLR - 从给定搜索请求的相交多边形中获取所有文档条目

问题描述

我正在运行带有一组 OSM 地址的 SOLR。另一方面,我在同一个集合中有一些多边形。我在我的 solr 中安装了 JTS,一切正常。

我的问题:例如,用户正在搜索这样的特定地址:

/solr/select?q=Bruhweg&wt=json

结果将如下所示:

    "type":["Feature"],
    "wkt":["POLYGON((9.0650999 48.80407349974092,9.065108 48.80405349974092,9.0651604 48.804044599740934,9.0651758 48.80405819974092,9.0652663 48.804044699740935,9.0652795 48.804077499740934,9.065298 48.804074799740924,9.06531 48.80411229974091,9.0653315 48.80411249974092,9.0653495 48.804152299740906,9.0653595 48.804185299740894,9.065227 48.8042043997409,9.0652154 48.804206599740894,9.0652046 48.80417829974089,9.0651805 48.8041809997409,9.065163500000002 48.8041373997409,9.0651464 48.8041391997409,9.0651335 48.80409639974092,9.0651051 48.80409789974092,9.0650999 48.80407349974092))"],
    "properties.label":"Bruhweg 11"
    "properties.category":"address"

其中“wkt”字段与正确的 SOLR 类型匹配,我们可以通过以下请求简单地验证:

solr/select?fq=wkt%3A%22Intersects(9.0650999%2048.80407349974092)%22&q= &wt=json*

请注意,我刚刚从“Bruhweg 11”多边形中获取了第一个坐标。结果如下所示:

    "type":["Feature"],
    "wkt":["POLYGON((9.0650999 48.80407349974092,9.065108 48.80405349974092,9.0651604 48.804044599740934,9.0651758 48.80405819974092,9.0652663 48.804044699740935,9.0652795 48.804077499740934,9.065298 48.804074799740924,9.06531 48.80411229974091,9.0653315 48.80411249974092,9.0653495 48.804152299740906,9.0653595 48.804185299740894,9.065227 48.8042043997409,9.0652154 48.804206599740894,9.0652046 48.80417829974089,9.0651805 48.8041809997409,9.065163500000002 48.8041373997409,9.0651464 48.8041391997409,9.0651335 48.80409639974092,9.0651051 48.80409789974092,9.0650999 48.80407349974092))"],
    "properties.label":"Bruhweg 11"
    "properties.category":"address"

    "type":["Feature"],
    "wkt":["POLYGON((9.04226364394244 48.78375351560371,9.056374594613018 48.78376897799828,9.059599869694331 48.78163342420202,9.081809522348271 48.78162969553386,9.081761686040636 48.78226547394644,9.082034238895682 48.78253237030596,9.0856383112481 48.783065728036505,9.081013408886774 48.784895520573016,9.08026549061692 48.78523860978792,9.075279465525824 48.78709720944531,9.075385415333642 48.78784623302399,9.075233988916805 48.78855044494239,9.07538936442188 48.789573632543714,9.076086792392704 48.7899895067132,9.076400978454831 48.79076807795856,9.076954863544922 48.791675940101136,9.077323565779931 48.79247426327167,9.077661454940172 48.79359088232947,9.07820886975919 48.79468135994337,9.078817709274189 48.79498392847467,9.079201898938019 48.79520667445914,9.08016333903955 48.79554857516962,9.079778914425672 48.79518198750416,9.079578091974522 48.79467583486249,9.07960878146339 48.79427927263826,9.079777474351143 48.794273758443296,9.079890211573053 48.79495800149708,9.08018722352202 48.795156515552904,9.080499405509059 48.795473674672415,9.080691862967708 48.795850379952874,9.080924981851217 48.79602374816294,9.081213923069749 48.79636161227024,9.08216503129647 48.797025378100585,9.082445049467385 48.796812064430696,9.082997510785853 48.79666782293686,9.083016532890815 48.798210792078066,9.084546369553149 48.79818997904426,9.08436196313672 48.79857684935421,9.084539100024378 48.798725962114545,9.084861025057869 48.79994602380419,9.084990671623789 48.80091802856458,9.08494424868377 48.80165186074672,9.085041682576207 48.80209339903589,9.08538756537159 48.802966378021715,9.086053469766966 48.80390370812341,9.085797560540206 48.803894003364,9.085814723600494 48.80437509265621,9.085407910580006 48.80612600144947,9.086188011009677 48.80771257109675,9.087281863093846 48.80971073096298,9.086304168618957 48.809607114458665,9.08560710806074 48.80961663014216,9.084061519923088 48.80938486330555,9.084077207035987 48.80980658042419,9.083543243778244 48.811250273222925,9.056400173581295 48.81120764569635,9.055584833918676 48.81131770190693,9.05233070753251 48.81010351728196,9.050449180583943 48.81143341235964,9.047719936766072 48.81048226708057,9.047480579846537 48.81086460229471,9.04435778697807 48.809744505510096,9.042626974936422 48.809303638995836,9.038908229735283 48.80850647660382,9.037144908448282 48.808184194812405,9.038129032787538 48.805980772861595,9.038328485640509 48.8051777307488,9.03824791543268 48.80471104904327,9.03876113924191 48.80479984728909,9.03889592317821 48.802984244443905,9.037701980314722 48.802949557020376,9.036369132836748 48.80272688628704,9.035368430087201 48.802290085608014,9.035368259304592 48.8020471956323,9.033685064639178 48.801228620567926,9.032644752493526 48.800737922085965,9.03217057774127 48.8000889091118,9.032098034258505 48.799508062093246,9.031417252535123 48.79921048432656,9.031802215987176 48.798784151506815,9.031441019924467 48.798238377399365,9.03225196905176 48.797687782137466,9.033547957749326 48.79595641436032,9.038695453795164 48.79394510865497,9.03934415364024 48.7933001500083,9.041676969957162 48.7917058788909,9.043068750531523 48.789672193708604,9.043444520390391 48.788257529857816,9.043555307907576 48.787275490180576,9.042249027750703 48.785802079685375,9.042512195810728 48.784854079302804,9.042199907427747 48.7840458175582,9.04226364394244 48.78375351560371))"],
    "properties.label":"polygonA",
    "properties.category":"polygons"

我想要什么:如果用户只是在搜索Bruhweg我想要的结果是地址和多边形类别中的多边形A

任何想法如何解决这个问题?

标签: solrgeospatialsolrcloud

解决方案


推荐阅读