1
これは私のXML文書がどのように見えるかです:PHP:対応するインデックスを持つ別のforeachループでforeachループの表示値
<?xml version="1.0" encoding="UTF-8"?>
<response>
<result name="response" numFound="111" start="0">
<doc>
<str name="id">http://www.ams.at/</str>
<str name="title">Startseite - Arbeitsmarktservice Österreich</str>
<str name="url">http://www.ams.at/</str>
<str name="content">evölkerung zurück. 982.000 Personen ab 50 Jahren hatten zuletzt einen</str>
</doc>
<doc>
<str name="id">http://www.ams.at/ueber-ams/medien/download-formulare</str>
<str name="title">Download und Formulare - Arbeitsmarktservice Österreich</str>
<str name="url">http://www.ams.at/ueber-ams/medien/download-formulare</str>
<str name="content">Download und Formulare - Arbeitsmarktnen Kundmachung AMS-Richtlinien Impressum AGB Sitemap Die</str>
</doc>
</result>
<lst name="highlighting">
<lst name="http://www.ams.at/service-arbeitsuchende/download-formulare">
<arr name="content">
<str>Service für Arbeitsuchende Service für Unternehmen <em>Berufsinformation</em> & Weiterbildung Service für Partner</str>
</arr>
</lst>
<lst name="http://www.ams.at/berufsinfo-weiterbildung/berufsinfo-broschueren">
<arr name="content">
<str><em>Berufsinformation</em>: Kataloge, Broschüren und mehr - Arbeitsmarktservice Österreich English Schrift</str>
</arr>
</lst>
</lst>
</response>
目的はPHP
とSolr
クエリの検索結果を表示することです。 Title and the Content
と表示されます。
私はtitle
、url
とcontent
を取得ドキュメントノード上foreach
ループを行うテーブルを持っています。
しかし、のコンテンツフィールドは、検索クエリの関連するコンテンツのみを使用したいので使用できません。だから、私はSolrハイライトを使用しています。残念ながら、私は今$data->result->doc
データを持っていますが、ハイライトのコンテンツは、私は必要なものresult->doc
ではありません。 私は私のテーブルがあり、各ドキュメントの結果のエントリを持つようにforeachループを行うと、私は、対応するコンテンツを持つようにしたいですハイライト表示フィールドのdoc->title[0] + highlighting->content[0]
など。
は、XMLやJSONのですか? –
空の変数型の配列を作成し、foreachループで必要なものを押してください。:) –